﻿using System.Windows.Forms;
using Microsoft.Office.PowerPoint.STAMP.Properties;

namespace Microsoft.Office.PowerPoint.STAMP.Core
{
    /// <summary>
    /// Builds a <see cref="IProgressObserver"/> for removing captions.
    /// </summary>
    public class RemoveCaptionsObserverBuilder
    {
        private readonly int _captionCount;

        /// <summary>
        /// Initializes a new instance of the <see cref="ProgressObserverBuilder"/> class.
        /// </summary>
        /// <param name="captionCount">The caption count.</param>
        public RemoveCaptionsObserverBuilder(int captionCount)
        {
            _captionCount = captionCount;
        }

        /// <summary>
        /// Builds a <see cref="IProgressObserver"/> instance.
        /// </summary>
        /// <returns></returns>
        public IProgressObserver Build()
        {
            IProgressObserver observer;
            if (_captionCount > Settings.Default.ProcessingNotificationLimit)
            {
                observer = new RemoveCaptionsProgressObserverWithForm(_captionCount);
            }
            else
            {
                observer = new ProgressObserverThatDoesNothing();
            }
            return observer;
        }
    }
}